package com.example.yls.demoa;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import java.io.File;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        findViewById(R.id.btn_getDetect).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                File file = getFilesDir().getAbsoluteFile();
                final String filePath = String.valueOf(file)+"/timg.jpg";
                Log.e("MainActivity",String.valueOf(file));
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        FaceDetect.detect(filePath);
                    }
                }).start();
            }
        });

        findViewById(R.id.btn_getMatch).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                File file = getFilesDir().getAbsoluteFile();
                final String filePath = String.valueOf(file)+"/left.jpg";
                final String filePath2 = String.valueOf(file)+"/right.jpg";
                Log.e("MainActivity",String.valueOf(file));
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        FaceMatch.match(filePath,filePath2);
                    }
                }).start();
            }
        });
    }
}
